"/^rating[=|:](?:([sqeu]+)|(safe|questionable|explicit|unknown))$/D"
"rating IN ($set)"
"/^note[=|:](.*)$/i"
"images.id IN (SELECT image_id FROM notes WHERE note = $notes)"
"/^notes([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)%/i"
"images.id IN (SELECT id FROM images WHERE notes $cmp $notes)"
"/^notes_by[=|:](.*)$/i"
"images.id IN (SELECT image_id FROM notes WHERE user_id = $user_id)"
"/^notes_by_userno[=|:](\d+)$/i"
"images.id IN (SELECT image_id FROM notes WHERE user_id = $user_id)"
"/^pool[=|:]([0-9]+|any|none)$/i"
"images.id $not IN (SELECT DISTINCT image_id FROM pool_images)"
"images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"
"/^pool_by_name[=|:](.*)$/i"
"images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"
"/^parent[=|:]([0-9]+|any|none)$/"
"images.parent_id IS $not NULL"
"images.parent_id = :pid"
"/^child[=|:](any|none)$/"
"images.has_children $not TRUE"
"/^(.+)tags([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9]+)$/i"
"EXISTS (
SELECT 1
FROM image_tags it
LEFT JOIN tags t ON it.tag_id = t.id
WHERE images.id = it.image_id
GROUP BY image_id
HAVING SUM(CASE WHEN t.tag LIKE '$type:%' THEN 1 ELSE 0 END) $cmp $count
)"
"/^score([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(-?\d+)$/i"
"numeric_score $cmp $score"
"/^upvoted_by[=|:](.*)$/i"
"images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=1)"
"/^downvoted_by[=|:](.*)$/i"
"images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=-1)"
"/^upvoted_by_id[=|:](\d+)$/i"
"images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=1)"
"/^downvoted_by_id[=|:](\d+)$/i"
"images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=-1)"
"/^order[=|:](numeric_)?(score)[_]?(desc|asc)?$/i"
"images.numeric_score $sort"
"/^tags([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i"
'images.id IN (SELECT DISTINCT image_id FROM image_tags GROUP BY image_id HAVING count(image_id) '.$cmp.' '.$tags.')'
"/^ratio([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+):(\d+)$/i"
"width / height $cmp :width{$this->stpen} / :height{$this->stpen}"
"/^(filesize|id)([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+[kmg]?b?)$/i"
"images.$col $cmp :val{$this->stpen}"
"/^(hash|md5)[=|:]([0-9a-fA-F]*)$/i"
'images.hash = :hash'
"/^(filetype|ext)[=|:]([a-zA-Z0-9]*)$/i"
'images.ext = :ext'
"/^(filename|name)[=|:]([a-zA-Z0-9]*)$/i"
"images.filename LIKE :filename{$this->stpen}"
"/^(source)[=|:](.*)$/i"
"/^(any|none)$/i"
"images.source IS $not NULL"
'images.source LIKE :src'
"/^posted([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9-]*)$/i"
"images.posted $cmp :posted{$this->stpen}"
"/^size([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)x(\d+)$/i"
"width $cmp :width{$this->stpen} AND height $cmp :height{$this->stpen}"
"/^width([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i"
"width $cmp :width{$this->stpen}"
"/^height([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i"
"height $cmp :height{$this->stpen}"
"/^order[=|:](id|width|height|filesize|filename)[_]?(desc|asc)?$/i"
"images.$ord $sort"
"/^order[=|:]random[_]([0-9]{1,4})$/i"
"RAND($seed)"
"/^favorites([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i"
"images.id IN (SELECT id FROM images WHERE favorites $cmp $favorites)"
"/^favorited_by[=|:](.*)$/i"
"images.id IN (SELECT image_id FROM user_favorites WHERE user_id = $user_id)"
"/^favorited_by_userno[=|:](\d+)$/i"
"images.id IN (SELECT image_id FROM user_favorites WHERE user_id = $user_id)"
"/^author[=|:](.*)$/i"
"Author = :author_char"
"/^(poster|user)[=|:](.*)$/i"
"images.owner_id = $user_id"
"/^(poster|user)_id[=|:]([0-9]+)$/i"
"images.owner_id = $user_id"
"/^(poster|user)_ip[=|:]([0-9\.]+)$/i"
"images.owner_ip = '$user_ip'"
"/^comments([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i"
"images.id IN (SELECT DISTINCT image_id FROM comments GROUP BY image_id HAVING count(image_id) $cmp $comments)"
"/^commented_by[=|:](.*)$/i"
"images.id IN (SELECT image_id FROM comments WHERE owner_id = $user_id)"
"/^commented_by_userno[=|:]([0-9]+)$/i"
"images.id IN (SELECT image_id FROM comments WHERE owner_id = $user_id)"